package com.bobi.tfca.model.entity;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bobi.tfca.model.vo.ArticleVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 文章实体
 * @author 李文发
 * @date 2024/4/2
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "article")
public class ArticleEntity {

    @TableId
    @ApiModelProperty(value = "文章id")
    // 文章id
    private Integer articleId;
    @ApiModelProperty(value = "文章标题")
    // 文章标题
    private String title;
    @ApiModelProperty(value = "文章类型")
    // 文章类型
    private Integer category;
    @ApiModelProperty(value = "作者id")
    // 作者id
    private Integer authorId;
    @ApiModelProperty(value = "发布时间")
    // 发布时间
    private LocalDateTime releaseTime;
    @ApiModelProperty(value = "点赞数")
    // 点赞数
    private Integer likes;
    @ApiModelProperty(value = "封面图片")
    // 封面图片
    private String outsidePicture;
    @ApiModelProperty(value = "文章状态（0：草稿，1：待审核，2：已发布，3：已删除）")
    // 文章状态（0：草稿，1：待审核，2：已发布，3：已删除）
    private Integer articleStatus;

    public static ArticleVO ofArticleEntity(ArticleEntity entity) {
        ArticleVO articleVO = new ArticleVO();
        BeanUtil.copyProperties(entity, articleVO);
        return articleVO;
    }
}
